package month4.day19;


import java.util.ArrayList;
import java.util.List;

public class Firm {
    private String name;
    private String site;
    private String telephone;
    private String range;
    //招聘员工（要求工号不能重复）
    List list=new ArrayList();
    public boolean add(Staff staff){
        if(list.contains(staff)){
            System.out.println("工号重复");
            return false;
        }
        System.out.println("招聘成功");
        list.add(staff);
        return true;
    }
    //输出员工信息
    public void show(){
        for(Object o:list){
            Staff staff=(Staff) o;
            staff.show();
        }
    }
    //辞退员工
    public boolean refuse(String number){
        Staff s=new Staff();
        s.setNumber(number);
        return list.remove(s);
    }
    //公司人数
    public int count(){
        return list.size();
    }
    //薪水最高的员工
    public Staff staff(){
        Staff sf=new Staff();
        sf.setMoney(0);
        if(list.isEmpty())
            return null;
        for(Object o:list){
            Staff staff=(Staff) o;
            if(staff.getMoney()>sf.getMoney())
                sf=staff;
        }
        return sf;
    }

    public Firm(String name, String site, String telephone, String range) {
        this.name = name;
        this.site = site;
        this.telephone = telephone;
        this.range = range;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSite() {
        return site;
    }

    public void setSite(String site) {
        this.site = site;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getRange() {
        return range;
    }

    public void setRange(String range) {
        this.range = range;
    }

    public List getList() {
        return list;
    }

    public void setList(List list) {
        this.list = list;
    }
}
